package com.service.utility.common;

import org.springframework.util.ObjectUtils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class EmailUtil {

	/**
	 * 验证当前字符串是否是邮箱
	 * @param verifyStr
	 * @return
	 */
	public static boolean isEmail(String verifyStr){
		if (ObjectUtils.isEmpty(verifyStr)) return false;
		Pattern p =  Pattern.compile("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");//复杂匹配
		Matcher m = p.matcher(verifyStr);
		return m.matches();
	}
}
